"use strict";
cc._RF.push(module, 'c61c4ULMXFISI0IWw+tsoHX', 'HallScene');
// scripts/HallScene.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
},
    r = void 0 && (void 0).__awaiter || function (t, e, o, i) {
  return new (o || (o = Promise))(function (n, a) {
    function r(t) {
      try {
        l(i.next(t));
      } catch (e) {
        a(e);
      }
    }

    function s(t) {
      try {
        l(i["throw"](t));
      } catch (e) {
        a(e);
      }
    }

    function l(t) {
      var e;
      t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
        t(e);
      })).then(r, s);
    }

    l((i = i.apply(t, e || [])).next());
  });
},
    s = void 0 && (void 0).__generator || function (t, e) {
  var o,
      i,
      n,
      a,
      r = {
    label: 0,
    sent: function sent() {
      if (1 & n[0]) throw n[1];
      return n[1];
    },
    trys: [],
    ops: []
  };
  return a = {
    next: s(0),
    "throw": s(1),
    "return": s(2)
  }, "function" == typeof Symbol && (a[Symbol.iterator] = function () {
    return this;
  }), a;

  function s(t) {
    return function (e) {
      return l([t, e]);
    };
  }

  function l(a) {
    if (o) throw new TypeError("Generator is already executing.");

    for (; r;) {
      try {
        if (o = 1, i && (n = 2 & a[0] ? i["return"] : a[0] ? i["throw"] || ((n = i["return"]) && n.call(i), 0) : i.next) && !(n = n.call(i, a[1])).done) return n;

        switch (i = 0, n && (a = [2 & a[0], n.value]), a[0]) {
          case 0:
          case 1:
            n = a;
            break;

          case 4:
            return r.label++, {
              value: a[1],
              done: !1
            };

          case 5:
            r.label++, i = a[1], a = [0];
            continue;

          case 7:
            a = r.ops.pop(), r.trys.pop();
            continue;

          default:
            if (!(n = (n = r.trys).length > 0 && n[n.length - 1]) && (6 === a[0] || 2 === a[0])) {
              r = 0;
              continue;
            }

            if (3 === a[0] && (!n || a[1] > n[0] && a[1] < n[3])) {
              r.label = a[1];
              break;
            }

            if (6 === a[0] && r.label < n[1]) {
              r.label = n[1], n = a;
              break;
            }

            if (n && r.label < n[2]) {
              r.label = n[2], r.ops.push(a);
              break;
            }

            n[2] && r.ops.pop(), r.trys.pop();
            continue;
        }

        a = e.call(t, r);
      } catch (s) {
        a = [6, s], i = 0;
      } finally {
        o = n = 0;
      }
    }

    if (5 & a[0]) throw a[1];
    return {
      value: a[0] ? a[1] : void 0,
      done: !0
    };
  }
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var l = t("CarConstant"),
    c = t("GlobalUserData"),
    d = t("GameConstant"),
    h = t("GameSpeedClickView"),
    p = t("Hint"),
    u = t("BroadCastMessage"),
    f = t("ChannelTool"),
    m = t("HallAudioControl"),
    _ = t("Util"),
    y = t("Global"),
    g = t("RedPointControl "),
    v = t("BaseStorage"),
    C = t("HallAssemblyView"),
    b = t("HallBoxView"),
    w = t("HallCarTotalView"),
    S = t("HallConstant"),
    I = t("TopContent"),
    B = t("HallActivityView"),
    T = t("HallDailyView"),
    A = t("HallGoldSupply"),
    G = t("HallShopView"),
    D = t("HallVitControl"),
    O = t("StorageManager"),
    R = t("Common"),
    P = t("ChampionManager"),
    U = t("AssetsManager"),
    x = t("SceneManager"),
    N = cc._decorator,
    k = N.ccclass,
    L = N.property,
    M = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.pfb_black = null, e.pfb_speedClick = null, e.boxView_control = null, e.pro_winNum = null, e.label_winNum = null, e.frame_box = null, e.frame_bottom = null, e.arena_bottom = null, e.frame_btnAssmbly = null, e.btn_moreGame = null, e.btnGamePortal = null, e.lab_Trophy = null, e.btnInstallShortCut = null, e.gashaponView = null, e.hallBgSpriteFrame = null, e.assemblyBgSpriteFrame = null, e.node_newcommer = null, e.node_arena_mask = null, e.node_setting = null, e.spr_headFrame = null, e.nWinningMaskWidth = 0, e._audioControl = null, e._assemblyView = null, e.node_assembly = null, e.node_bg_hall = null, e.gift_frame = null, e.node_car = null, e.node_hall = null, e.frame_head = null, e.frame_Gold = null, e.frame_Diamond = null, e.frame_Vit = null, e.frame_guide = null, e.frame_content = null, e.hallMatchView = null, e.topContent = null, e._strOldUser = "0", e.showGamePortalAd = function () {
      var t = this;

      _.Util.showGamePortalAd(function () {
        t.canClickPortalAd = !0, _.Util.hideNativeBanner(), _.Util.hideHallBanner(), console.log("showGamePortalAd:原生banner隐藏");
      });
    }, e.prevGoldNum = 0, e.prevDiamondNum = 0, e._vitControl = null, e.isVideo = !1, e.isMatch = !1, e.bLoadedSub = !1, e.posFrame_btnAssmbly = cc.v3(19, 0, 0), e.posFrame_Box = cc.v3(-516, -268, 0), e.posFrame_Bottom = cc.v3(445, -277, 0), e;
  }

  return n(e, t), e.prototype.onLoad = function () {
    var t = this;
    cc.director.getPhysicsManager().enabled = !0, cc.director.getCollisionManager().enabled = !0, this.node_bg_hall = this.node.getChildByName("bg_hall"), this.gift_frame = this.node.getChildByName("gift_frame"), this.node_car = this.node.getChildByName("car"), this.node_hall = this.node.getChildByName("hall"), this.frame_head = this.node.getChildByName("frame_top"), this.frame_Gold = this.node.getChildByName("frame_gold"), this.frame_Diamond = this.node.getChildByName("frame_diamond"), this.frame_Vit = this.node.getChildByName("frame_vit"), this.frame_guide = this.node.getChildByName("guide"), this.frame_content = this.node.getChildByName("content"), this.frame_guide.active = !0, this.scheduleOnce(function () {
      t.frame_guide.active = !1;
    }, 0), 0 == c["default"].nLoginTime && (c["default"].saveLoginTimeData(), this.initFistLoginData()), 0 == c["default"].nFirstDate ? this._strOldUser = "1" : (new Date().getTime() - c["default"].nFirstDate) / 36e5 >= 24 ? (this._strOldUser = "2", c["default"].saveGuideStepData(S.Guide_Step.Finish)) : this._strOldUser = "1", c["default"]._strOldUser = this._strOldUser, this.initData(), _.Util.is_wx() || this.btn_moreGame && (this.btn_moreGame.active = !1), f.ChannelTool.curentChannel != f.ChannelTool.ChannelEnum.OPPO && this.btnGamePortal && (this.btnGamePortal.active = !1);
  }, e.prototype.start = function () {
    _.Util.newBanner();

    if (localStorage.getItem("Hide") != "1") this.ShowHide();
    this._audioControl = this.node.getComponent(m["default"]), this.onShowHall(!0), this.init(), this.node.on("HallBtnSign", this.onBtnSign, this), this.node.on("HallBtnActivity", this.onBtnActivity, this), this.node.on("HallBtnDaily", this.onBtnDaily, this), this.node.on("HallBtnExplore", this.onBtnExplore, this), this.node.on("HallBtnRank", this.onBtnRank, this), this.node.on("HallBtnTask", this.onBtnTask, this), this.node.on("HallBtnLottery", this.onBtnLottery, this), this.node.on("HallBtnDepot", this.onBtnDepot, this), c["default"].isTryCar = !1, this.scheduleOnce(function () {
      this.loadAssemblyNode();
    }, 0), this.scheduleOnce(function () {
      this.delayLoadPrefab();
    }, 0), this.initShortCut(), this.refreshRedPointStatus(), this.comebackshow(), P["default"].Ins.setGradeWithFrame(this.spr_headFrame), c["default"].nTrophy >= 150 ? (this.node_arena_mask.active = !1, v.BaseStorage.setInt("arena_unlock", 1)) : v.BaseStorage.getInt("arena_unlock", 0) ? this.node_arena_mask.active = !1 : this.node_arena_mask.active = !0, _.Util.init_majia_banner();
  }, e.prototype.refreshRedPointStatus = function () {
    O.StorageManager.setDailyTaskStorageKey("user_DailyRedPointState"), g.RedPointControl.getInstance().cal(y.RedPointCalKey.Daily);
  }, e.prototype.onBtnLockTip = function () {
    p["default"].show("未解锁");
  }, e.prototype.refreshNewCommer = function () {
    v.BaseStorage.getInt(y.BaseStorageKey.FreeCarPro, 0) >= 5 ? this.node_newcommer.active = !1 : (this.node_newcommer.active = !0, c["default"].freePopup && c["default"].nGuideStep >= S.Guide_Step.trySuperCar && _.Util.probability(c["default"].newcomer) && this.onBtnNewcomerPkg());
  }, e.prototype.comebackshow = function () {
    _.Util.probability(c["default"].inAdPro) && !c["default"].isFirstHall && _.Util.showInterstitialAd(), c["default"].isFirstHall = !1, this.refreshNewCommer();
  }, e.prototype.initShortCut = function () {
    return r(this, void 0, void 0, function () {
      return s(this, function (t) {
        switch (t.label) {
          case 0:
            return [4, _.Util.hasInstallShortCut()];

          case 1:
            return t.sent() || !_.Util.is_qg() ? this.btnInstallShortCut.active = !1 : this.btnInstallShortCut.active = !0, [2];
        }
      });
    });
  }, e.prototype.loadNode = function () {
    return r(this, void 0, void 0, function () {
      var t;
      return s(this, function (e) {
        switch (e.label) {
          case 0:
            return [4, _.Util.getPrefabNode("prefab/nativeHallBanner")];

          case 1:
            return t = e.sent(), cc.director.getScene().getChildByName("Canvas").addChild(t), [2];
        }
      });
    });
  }, e.prototype.delayLoadPrefab = function () {
    var t = this;
    cc.resources.load("prefab/frame_top_content", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.topContent = i.getComponent(I["default"]), i.parent = t.node_hall;
    });
  }, e.prototype.loadAssemblyNode = function () {
    var t = this;
    null == this.node_assembly && cc.resources.load("prefab/assembly", cc.Prefab, function (e, o) {
      t.node_assembly = cc.instantiate(o), t.node_assembly.parent = t.frame_content, t._assemblyView = t.node_assembly.getComponent(C["default"]), t._assemblyView.initData(t), t.node_car.getComponent(w["default"]).setCarItemToAssemblyView(t._assemblyView), t.onGuideAction();
    });
  }, e.prototype.onGuideAction = function () {
    var t = this;

    if (c["default"].nTotalGame <= 2) {
      switch (this.node_car.getComponent(w["default"]).onGuideAction(), c["default"].nGuideStep) {
        case Number(S.Guide_Step.Fight):
        case Number(S.Guide_Step.Fight2):
        case Number(S.Guide_Step.Fight3):
          this.guide_click(this.frame_bottom, -1);
      }

      var e;
      c["default"].nGuideStep != S.Guide_Step.Box_Get && c["default"].nGuideStep != S.Guide_Step.Box_Get2 || (c["default"].saveBoxData(!0, {
        state: S.Box_State.Lock,
        time: 0
      }), e = c["default"].nGuideStep == S.Guide_Step.Box_Get ? S.Guide_Step.Box_Get_open1 : S.Guide_Step.Box_Get_open2, c["default"].saveGuideStepData(e)), c["default"].nGuideStep != S.Guide_Step.Box_Get_open1 && c["default"].nGuideStep != S.Guide_Step.Box_Get_open2 || (this.boxView_control.updateView(), this.scheduleOnce(function () {
        t.guide_click(t.frame_box, -1);
      }, 0));
    }

    3 === c["default"].nTotalGame && c["default"].nGuideStep == S.Guide_Step.boxHint && (u["default"].getInstance().SendMessage("guide_hint", this.pro_winNum.node, 1), c["default"].saveGuideStepData(S.Guide_Step.trySuperCar));
  }, e.prototype.onBtnSettingView = function () {
    var t = this;
    cc.resources.load("server/settingView", cc.Prefab, function (e, o) {
      cc.instantiate(o).parent = t.node;
    });
  }, e.prototype.onDestroy = function () {
    this.node.off("HallBtnSign", this.onBtnSign, this), this.node.off("HallBtnActivity", this.onBtnActivity, this), this.node.off("HallBtnDaily", this.onBtnDaily, this), this.node.off("HallBtnExplore", this.onBtnExplore, this), this.node.off("HallBtnRank", this.onBtnRank, this), this.node.off("HallBtnTask", this.onBtnTask, this), this.node.off("HallBtnLottery", this.onBtnLottery, this), this.node.off("HallBtnDepot", this.onBtnDepot, this);
  }, e.prototype.onBtnGamePortalAd = function () {
    this.unschedule(this.showGamePortalAd), this.scheduleOnce(this.showGamePortalAd, .2);
  }, e.prototype.initData = function () {
    this.posFrame_btnAssmbly = this.frame_btnAssmbly.position, this.posFrame_Box = this.frame_box.position, this.posFrame_Bottom = this.frame_bottom.position;
  }, e.prototype.initFistLoginData = function () {
    for (var t = [{
      bodyId: "body05",
      wheel0Id: "wheel01",
      wheel1Id: "wheel01",
      weapon0Id: l.Weapon_ID.Hammer
    }], e = 0; e < c["default"].nEquipMax; e++) {
      if (e < t.length) {
        var o = this.getFistItemData(t[e].bodyId, 1, l.Basics_Items_Type.body),
            i = this.getFistItemData(t[e].wheel0Id, 1, l.Basics_Items_Type.wheel),
            n = this.getFistItemData(t[e].wheel1Id, 1, l.Basics_Items_Type.wheel),
            a = this.getFistItemData(t[e].weapon0Id, 1, l.Basics_Items_Type.weapon);
        c["default"].saveOwnCarBodyData(!0, o), c["default"].saveOwnWheelData(!0, i), c["default"].saveOwnWheelData(!0, n), c["default"].saveOwnWeaponData(!0, a), c["default"].saveEquipBodyData(e, o.uid), c["default"].saveEquipWheelData(e, 0, i.uid), c["default"].saveEquipWheelData(e, 1, n.uid), c["default"].saveEquipWeaponData(e, 0, a.uid);
      }
    }
  }, e.prototype.getFistItemData = function (t, e, o, i, n, a) {
    void 0 === i && (i = y.Quality.common), void 0 === n && (n = {
      type: null,
      id: null,
      buffType: y.BuffType.hp,
      number: 0
    }), void 0 === a && (a = 1);
    var r = null;

    switch (o) {
      case l.Basics_Items_Type.body:
        r = l.getBodyData(t);
        break;

      case l.Basics_Items_Type.wheel:
        r = l.getWheelData(t);
        break;

      case l.Basics_Items_Type.weapon:
        r = l.getWeaponData(t);
        break;

      case l.Basics_Items_Type.tools:
        r = l.getToolsData(t);
    }

    return _.Util.getItemData(r.id, r.type, e, l.GetRandomItemHp(r, e), l.GetRandomItemDamage(r, e), l.GetRandomItemElec(r, e), r.quality, n, a);
  }, e.prototype.getAllItemsData = function () {
    for (var t = [], e = l.GetBoxAllItemsData(), o = 0; o < e.length; o++) {
      t.push(this.getOneItemData(e[o], 3));
    }

    c["default"].saveOwnCarData(t);
  }, e.prototype.getOneItemData = function (t, e) {
    return _.Util.getItemData(t.id, t.type, e, l.GetRandomItemHp(t, e), l.GetRandomItemDamage(t, e), l.GetRandomItemElec(t, e), t.quality);
  }, e.prototype.init = function () {
    var t = _.Util.getRandomInt(0, 30);

    c["default"].nCurGameType = t < 10 ? d.Game_Type.PK_1 : t < 20 ? d.Game_Type.PK_2 : d.Game_Type.PK, this.initView();
  }, e.prototype.initView = function () {
    this.onSetOwnGold(), this.onSetOwnDiamond(), this.onSetOwnVit(), this.onSetOwnTrophy(), this.initWinTotal(), this.initFailTotal(), this.node_car.getComponent(w["default"]).init(this);
  }, e.prototype.onSetOwnGold = function (t) {
    var e = this;

    if (t) {
      var o = this.frame_Gold.getChildByName("icon"),
          i = this.frame_Gold.getChildByName("lab_gold");

      _.Util.AnimNumJump(i, this.prevGoldNum, c["default"].nGlod, function (t) {
        i.getComponent(cc.Label).string = _.Util.transformGoldStr(t);
      }, function () {
        i.getComponent(cc.Label).string = _.Util.transformGoldStr(c["default"].nGlod), e.prevGoldNum = c["default"].nGlod;
      }, o);
    } else this.frame_Gold.getChildByName("lab_gold").getComponent(cc.Label).string = _.Util.transformGoldStr(c["default"].nGlod), this.prevGoldNum = c["default"].nGlod;
  }, e.prototype.onSetOwnDiamond = function (t) {
    var e = this;

    if (t) {
      var o = this.frame_Diamond.getChildByName("icon"),
          i = this.frame_Diamond.getChildByName("lab_diamond");

      _.Util.AnimNumJump(i, this.prevDiamondNum, c["default"].nDiamond, function (t) {
        i.getComponent(cc.Label).string = _.Util.transformGoldStr(t);
      }, function () {
        i.getComponent(cc.Label).string = _.Util.transformGoldStr(c["default"].nDiamond), e.prevDiamondNum = c["default"].nDiamond;
      }, o);
    } else this.frame_Diamond.getChildByName("lab_diamond").getComponent(cc.Label).string = _.Util.transformGoldStr(c["default"].nDiamond), this.prevDiamondNum = c["default"].nDiamond;
  }, e.prototype.onSetOwnVit = function (t) {
    this._vitControl || (this._vitControl = this.frame_Vit.getComponent(D["default"]), this._vitControl.init(this)), this._vitControl.onSetOwnVit(t);
  }, e.prototype.onSetOwnTrophy = function () {
    this.lab_Trophy.getComponent(cc.Label).string = _.Util.transformGoldStr(c["default"].nTrophy);
  }, e.prototype.initFailTotal = function () {
    c["default"].nFailTotal >= S.FailTotal_Max_Time && (c["default"].saveFailTotal(!1), c["default"].saveGameGradeData(!1));
  }, e.prototype.guide_click = function (t, e) {
    u["default"].getInstance().SendMessage("guide_click", t, e);
  }, e.prototype.guide_move = function (t, e, o, i) {
    u["default"].getInstance().SendMessage("guide_move", t, e, o, i);
  }, e.prototype.reset_Guide = function () {
    u["default"].getInstance().SendMessage("resetSize");
  }, e.prototype.hideGuide = function () {
    u["default"].getInstance().SendMessage("hideGuide");
  }, e.prototype.initWinTotal = function () {
    c["default"].nWinTotal >= S.WinTotal_Max_Time ? (this.pro_winNum.progress = 0, this.label_winNum.string = "0", this.onBtnWinTotalBox()) : (this.label_winNum.string = c["default"].nWinTotal.toString(), this.pro_winNum.progress = this.nWinningMaskWidth / S.WinTotal_Max_Time == 1 ? 0 : c["default"].nWinTotal / S.WinTotal_Max_Time);
  }, e.prototype.onBtnWinTotalBox = function () {
    this.playAudio(S.Audio_ID.btn_click), c["default"].nWinTotal >= S.WinTotal_Max_Time && (c["default"].saveWinTotal(!1), c["default"].saveGameGradeData(!0), c["default"].saveBoxData(!0, {
      state: S.Box_State.Lock,
      time: 0
    }), this.boxView_control.updateView());
  }, e.prototype.onBtnAddGold = function () {
    var t = this;
    cc.resources.load("prefab/goldSupply", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.node.addChild(i, 99), i.getComponent(A["default"]).initView(A.Supply_Type.Gold, t, null);
    });
  }, e.prototype.onBtnAddDiamond = function () {
    var t = this;
    cc.resources.load("prefab/goldSupply", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.node.addChild(i, 99), i.getComponent(A["default"]).initView(A.Supply_Type.Diamond, t, null);
    });
  }, e.prototype.onBtnAddHandBook = function () {
    var t = this;
    _.Util.hideHallBanner(), this.topContent.hindMore(), this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/handBook", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.node.addChild(i, 99);
    });
  }, e.prototype.onBtnActivity = function () {
    var t = this;
    this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/activityView", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      i.getComponent(B["default"]).initView(t), t.node.addChild(i);
    });
  }, e.prototype.onBtnDaily = function () {
    var t = this;
    this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/dailyView", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      i.getComponent(T["default"]).initView(t), t.node.addChild(i, 99);
    });
  }, e.prototype.onBtnRank = function () {
    var t = this;
    _.Util.is_wx() ? (this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/ranking", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.node.addChild(i, 99);
    })) : p["default"].show("敬请期待");
  }, e.prototype.onBtnSign = function () {
    var t = this;
    this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/Sign", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.node.addChild(i, 99);
    });
  }, e.prototype.onBtnTask = function () {
    var t = this;
    this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/DailyTask", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.node.addChild(i, 99);
    });
  }, e.prototype.onBtnLottery = function () {
    var t = this;
    this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/Lottery", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.node.addChild(i, 99);
    });
  }, e.prototype.onBtnChampion = function () {
    var t = this;
    this.playAudio(S.Audio_ID.btn_click), _.Util.getAssets(_.Util.getBundle(U.BundleName.XIE), U.assets.champion).then(function (e) {
      var o = cc.instantiate(e);
      t.node.addChild(o);
    });
  }, e.prototype.onBtnDepot = function () {
    var t = this;
    this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/SupplyDepot", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.node.addChild(i, 99);
    });
  }, e.prototype.onBtnExplore = function () {
    var t = this;
    this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/AddedBonus", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      t.node.addChild(i);
    });
  }, e.prototype.onBtnNewcomerPkg = function () {
    var t = this;
    this.playAudio(S.Audio_ID.btn_click), cc.resources.load("prefab/freeCar", cc.Prefab, function (e, o) {
      var i = cc.instantiate(o);
      c["default"].superCarPanel = i, t.node.addChild(i);
    });
  }, e.prototype.onBtnShop = function (t) {
    var e = this;
    void 0 === t && (t = !0), c["default"].isShopView = !0, _.Util.hideHallBanner(), this.playAudio(S.Audio_ID.btn_click), this.topContent.hindMore(), cc.resources.load("prefab/shopView", cc.Prefab, function (o, i) {
      var n = cc.instantiate(i);
      e.node.addChild(n, 99), e.frame_Gold.zIndex = 100, e.frame_Diamond.zIndex = 100, e.frame_Vit.zIndex = 100, _.Util.hideSingleCustomAd(!0), _.Util.hideSingleCustomAd(!1), n.getComponent(G["default"]).initView(e, function () {
        e.frame_Gold.zIndex = 0, e.frame_Diamond.zIndex = 0, e.frame_Vit.zIndex = 0, t && _.Util.showSingleCustomAd();
      });
    });
  }, e.prototype.onBtnShowMatchView = function (t, e) {
    var o = this;
    if (c["default"].gameMode = y.GameMode.Match, this.topContent.hindMore(), c["default"].vitData.num < S.Vit_Game_Num) return p["default"].show("体力不足"), void this.onShowVitPanel();
    _.Util.hideNativeGridAd(), _.Util.hideHallBanner(), _.Util.showNativeMatchBanner(), this.hallMatchView ? (Number(e) && this.playMusic(this.node.getComponent(m["default"]).match), this.hallMatchView.active = !0) : (!this.isVideo && c["default"].majiaGameNum % 2 == 0 && _.Util.isVideorSwitchOn("zjmsp") ? (this.isVideo = !0, _.Util.showRewardVideo(function () {
      o.isMatch = !0, c["default"].saveBoxData(!0, {
        state: S.Box_State.Lock,
        time: 0
      }), o._hallBoxItem.updateView(!0);
    }, function () {
      o.onMatch(e);
    }, function () {
      o.onMatch(e);
    })) : this.onMatch(e), R["default"].getIns().logEvent(R.LogEventType.HallMatchBtn, c["default"]._strOldUser + "" + c["default"].nTotalGame, 2));
  }, e.prototype.boxViewCallMatch = function () {
    this.isMatch && (this.isMatch = !1, this.onMatch("1"));
  }, e.prototype.onMatch = function (t) {
    var e = this;
    Number(t) && this.playMusic(this.node.getComponent(m["default"]).match), cc.resources.load("prefab/HallMatchView", cc.Prefab, function (t, o) {
      e.hallMatchView = cc.instantiate(o), e.node.addChild(e.hallMatchView);
    });
  }, e.prototype.playMusic = function (t) {
    void 0 === t && (t = this.node.getComponent(m["default"]).bgm_hall), this.node.getComponent(m["default"]).playMusic(t);
  }, e.prototype.onBtnShare = function () {
    _.Util.is_wx() || _.Util.is_tt() ? _.Util.shareAppMessage() : p["default"].show("敬请期待");
  }, e.prototype.onBtnGashapon = function () {
    this.node.addChild(cc.instantiate(this.gashaponView));
  }, e.prototype.getGoldWorldPos = function () {
    return this.frame_Gold.convertToWorldSpaceAR(cc.Vec3.ZERO);
  }, e.prototype.getDiamondWorldPos = function () {
    return this.frame_Diamond.convertToWorldSpaceAR(cc.Vec3.ZERO);
  }, e.prototype.getVitWorldPos = function () {
    return this.frame_Vit.convertToWorldSpaceAR(cc.Vec3.ZERO);
  }, e.prototype.onCreateSpeed = function (t) {
    _.Util.hideSingleCustomAd(!0), _.Util.hideSingleCustomAd(!1);
    var e = cc.instantiate(this.pfb_speedClick);
    this.node.addChild(e), e.getComponent(h["default"]).initView(function () {
      t();
    });
  }, e.prototype.onShowVitPanel = function () {
    this.node.getChildByName("frame_vit").getComponent(D["default"]).onBtnAdd();
  }, e.prototype.onBtnGameStart = function (t, e) {
    var o = this;
    if (_.Util.hideNativeGridAd(), _.Util.hideHallBanner(), c["default"].gameMode = 0 == Number(e) ? y.GameMode.Match : y.GameMode.Arena, this.playAudio(S.Audio_ID.btn_click), c["default"].vitData.num < S.Vit_Game_Num) return p["default"].show("体力不足"), void this.onShowVitPanel();
    _.Util.hideSingleCustomAd(!0), _.Util.hideSingleCustomAd(!1), _.Util.wxReportUseBehavior("hall", "btnGameStart", 2, this._strOldUser), c["default"].gameMode == y.GameMode.Match && (c["default"].saveVitData(!1, S.Vit_Game_Num), this.onSetOwnVit(!0), p["default"].showConsume(this.frame_bottom, y.ConsumeType.Vit, S.Vit_Game_Num), c["default"].nGuideStep == S.Guide_Step.Fight3 && c["default"].saveGuideStepData(S.Guide_Step.playharpoon));
    var i = !1;

    if (0 == c["default"].bAuditMode) {
      var n = c["default"].nTotalGame % 6;
      c["default"].arrShowSpeed && c["default"].arrShowSpeed[n] && _.Util.canShowGiftRush() && (i = !0, this.onCreateSpeed(function () {
        o.frame_bottom.getChildByName("btn_gamestart").getComponent(cc.Button).interactable = !1, o.arena_bottom.getChildByName("btn_gamestart").getComponent(cc.Button).interactable = !1, x.SceneManager.Instance.runScene(x.SceneName.gamePK);
      }));
    }

    i || this.scheduleOnce(function () {
      o.frame_bottom.getChildByName("btn_gamestart").getComponent(cc.Button).interactable = !1, o.arena_bottom.getChildByName("btn_gamestart").getComponent(cc.Button).interactable = !1, x.SceneManager.Instance.runScene(x.SceneName.gamePK);
    }, .5);
  }, e.prototype.loadGameSubpackage = function () {
    var t = this;
    this.scheduleOnce(function () {
      cc.assetManager.loadBundle("Game", function (e) {
        if (e) return cc.error(e);
        cc.log("hall --  load resources subpackage (Game) successfully."), t.bLoadedSub = !0;
      });
    }, 1.5);
  }, e.prototype.onBtnShowCustomAd = function () {
    cc.instantiate(this.pfb_black).parent = this.node, _.Util.show_matrixAd();
  }, e.prototype.onShowNextCar = function (t) {
    _.Util.wxReportUseBehavior("hall", "btnAssembly" + (t + 1), 2, this._strOldUser), this._assemblyView.onShowNextCar(t);
  }, e.prototype.onBtnAssembly = function (t) {
    this.topContent.hindMore(), this.playAudio(S.Audio_ID.btn_click), this.playAudio(S.Audio_ID.show_assembly), _.Util.wxReportUseBehavior("hall", "btnAssembly" + (t + 1), 2, this._strOldUser), this.onShowAssembly(t);
  }, e.prototype.onBtnBackHall = function () {
    this.playAudio(S.Audio_ID.btn_click), this.onShowHall();
  }, e.prototype.onShowHall = function (t) {
    var e = this;
    _.Util.wxReportUseBehavior("hall", "btnGameStart", 1, this._strOldUser), _.Util.wxReportUseBehavior("hall", "btnBox", 1, this._strOldUser), _.Util.wxReportUseBehavior("hall", "btnAssembly1", 1, this._strOldUser), _.Util.wxReportUseBehavior("hall", "btnAssembly2", 1, this._strOldUser), _.Util.wxReportUseBehavior("hall", "btnAssembly3", 1, this._strOldUser), c["default"].nGuideStep >= S.Guide_Step.Finish && !c["default"].isMatchToAssembly && _.Util.showSingleCustomAd();
    var o = !0;
    if (c["default"].isMatchToAssembly && (c["default"].isMatchToAssembly = !1, this.onBtnShowMatchView(null, "0"), o = !1), t) return this.node_bg_hall.getComponent(cc.Sprite).spriteFrame = this.hallBgSpriteFrame, this.gift_frame.active = !0, this._assemblyView && this._assemblyView.onShowHall(t), this.node_hall.active = !0, void this.node_car.getComponent(w["default"]).onShowHall();
    this._assemblyView && this._assemblyView.onShowHall(t), this.scheduleOnce(function () {
      e.frame_head.active = !0, e.frame_Diamond.x = e.frame_Diamond.x + 250, e.frame_Gold.x = e.frame_Gold.x + 250, e.frame_Diamond.active = !0, e.frame_Gold.active = !0, e.frame_Vit.active = !0, e.node_hall.active = !0, cc.tween(e.node_bg_hall).to(.3, {
        scale: 1
      }, {
        easing: "smooth"
      }).start(), cc.tween(e.node_car).to(.3, {
        scale: 1
      }, {
        easing: "smooth"
      }).start(), cc.tween(e.frame_btnAssmbly).to(.3, {
        position: cc.v3(e.posFrame_btnAssmbly.x, e.posFrame_btnAssmbly.y, 0)
      }, {
        easing: "bounceOut"
      }).call(function () {
        e.frame_btnAssmbly.getComponent(cc.Button).interactable = !0;
      }).start(), cc.tween(e.frame_bottom).to(.3, {
        position: cc.v3(e.posFrame_Bottom.x, e.posFrame_Bottom.y, 0)
      }, {
        easing: "bounceOut"
      }).call(function () {
        e.frame_bottom.getComponent(cc.Widget).enabled = !0, e.scheduleOnce(function () {
          o && (c["default"].popup = null, e.onGuideAction(), e.comebackshow());
        }, .2);
      }).start(), e.node_bg_hall.getComponent(cc.Sprite).spriteFrame = e.hallBgSpriteFrame, e.gift_frame.active = !0, e.node_car.getComponent(w["default"]).onShowHall();
    }, .15);
  }, e.prototype.onShowAssembly = function (t) {
    var e = this;
    _.Util.hideSingleCustomAd(!0), _.Util.hideSingleCustomAd(!1), _.Util.hideHallBanner(), this.frame_head.active = !1, this.frame_Vit.active = !1, this.frame_Diamond.active = !1, this.frame_Gold.active = !1, cc.tween(this.node_bg_hall).to(.3, {
      scale: 1.2
    }, {
      easing: "smooth"
    }).start(), cc.tween(this.node_car).to(.3, {
      scale: 1.2
    }, {
      easing: "smooth"
    }).start(), this.frame_btnAssmbly.getComponent(cc.Button).interactable = !1, cc.tween(this.frame_btnAssmbly).to(.3, {
      position: cc.v3(this.posFrame_btnAssmbly.x, this.posFrame_btnAssmbly.y + cc.winSize.height / 2, 0)
    }, {
      easing: "smooth"
    }).start(), this.frame_bottom.getComponent(cc.Widget).enabled = !1, cc.tween(this.frame_bottom).to(.3, {
      position: cc.v3(this.posFrame_Bottom.x, this.posFrame_Bottom.y - cc.winSize.height / 2, 0)
    }, {
      easing: "smooth"
    }).call(function () {
      e.node_hall.active = !1;
    }).start(), this.scheduleOnce(function () {
      e.node_bg_hall.getComponent(cc.Sprite).spriteFrame = e.assemblyBgSpriteFrame, e.gift_frame.active = !1, e._assemblyView && e._assemblyView.onShowAssembly(t), e.node_car.getComponent(w["default"]).onShowAssembly();
    }, .15);
  }, e.prototype.onEquipCarItem = function (t, e, o, i) {
    this.node_car.getComponent(w["default"]).onEquipCarItem(t, e, o, i);
  }, e.prototype.playAudio = function (t) {
    this._audioControl.playAudio(t);
  }, e.prototype.onBtnInstallShortCut = function () {
    var t = this;

    _.Util.installShortCut(function () {
      t.btnInstallShortCut.active = !1;
    }, function () {
      t.btnInstallShortCut.active = !1, t.scheduleOnce(function () {
        t.btnInstallShortCut.active = !0;
      }, 120);
    });
  }, e.prototype.ShowHide = function () {
    this.HidePanel.active = true;
  }, e.prototype.YesHide = function () {
    this.HidePanel.active = false;
    localStorage.setItem("Hide", "1");
  }, e.prototype.NoHide = function () {
    qg.exitApplication({
      success: function success() {
        console.log("exitApplication success");
      },
      fail: function fail() {
        console.log("exitApplication fail");
      },
      complete: function complete() {
        console.log("exitApplication complete");
      }
    });
  }, a([L(cc.Prefab)], e.prototype, "pfb_black", void 0), a([L(cc.Prefab)], e.prototype, "pfb_speedClick", void 0), a([L(b["default"])], e.prototype, "boxView_control", void 0), a([L(cc.ProgressBar)], e.prototype, "pro_winNum", void 0), a([L(cc.Label)], e.prototype, "label_winNum", void 0), a([L(cc.Node)], e.prototype, "frame_box", void 0), a([L(cc.Node)], e.prototype, "frame_bottom", void 0), a([L(cc.Node)], e.prototype, "arena_bottom", void 0), a([L(cc.Node)], e.prototype, "frame_btnAssmbly", void 0), a([L(cc.Node)], e.prototype, "btn_moreGame", void 0), a([L(cc.Node)], e.prototype, "btnGamePortal", void 0), a([L(cc.Node)], e.prototype, "lab_Trophy", void 0), a([L(cc.Node)], e.prototype, "btnInstallShortCut", void 0), a([L(cc.Prefab)], e.prototype, "gashaponView", void 0), a([L(cc.SpriteFrame)], e.prototype, "hallBgSpriteFrame", void 0), a([L(cc.SpriteFrame)], e.prototype, "assemblyBgSpriteFrame", void 0), a([L(cc.Node)], e.prototype, "node_newcommer", void 0), a([L(cc.Node)], e.prototype, "node_arena_mask", void 0), a([L(cc.Node)], e.prototype, "node_setting", void 0), a([L(cc.Node)], e.prototype, "HidePanel", void 0), a([L(cc.Sprite)], e.prototype, "spr_headFrame", void 0), a([k], e);
}(cc.Component);

o["default"] = M;

cc._RF.pop();